package com.ruoyi.controller;


import com.ruoyi.domain.T02;
import com.ruoyi.domain.T11;
import com.ruoyi.entity.VO.AccountInfo;
import com.ruoyi.service.IT02Service;
import com.ruoyi.service.IT07Service;
import com.ruoyi.service.IT11Service;
import com.ruoyi.service.YYDIT09Service;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/T02")
public class T02Controller {
    @Autowired
    private IT02Service t02Service;
    @Autowired
    private YYDIT09Service t09service;

    @Autowired
    private IT07Service t07Service;
    @Autowired
    private IT11Service t11Service;
    @GetMapping("/T02/getAccountInfo")
    @ApiOperation(value = "获取账户信息")
    public AccountInfo getAccountInfo(){
        T02 t02 = t02Service.getAccountInfo();
        int undo = t09service.checkUnfload();
        AccountInfo accountInfo = new AccountInfo();
        accountInfo.setToken(t02.getF0204());
        accountInfo.setName(t02.getF0202());
        accountInfo.setMoney(t02.getF0203());
        accountInfo.setUndo(undo);
        Integer totalMoney = t07Service.todayMoney();
        if (totalMoney==null)
            totalMoney=1;
        int increase = t07Service.increase();
        int total = t07Service.total();
        List<T11> listtoday = t07Service.selectlisttoday();
        List<T11> listtotal = t07Service.selectlisttotal();
        accountInfo.setListtoday(listtoday);
        accountInfo.setListtotal(listtotal);
        accountInfo.setIncrease(increase);
        accountInfo.setTotal(total);
        accountInfo.setTodaymoney(totalMoney);
        return accountInfo;
    }
}
